package com.atguigu.atcrowdfunding.dao;

import com.atguigu.atcrowdfunding.bean.Permission;
import com.atguigu.atcrowdfunding.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * lcd  2020/4/1
 * Description:
 */
public interface PermissionDao {
    @Select("select * from t_permission where pid=#{pid}")
    List<Permission> findPermissionByPid(int pid);

    @Select("select * from t_permission")
    List<Permission> findAll();

    void insert(Permission permission);

    @Select("select * from t_permission where id=#{id}")
    Permission findById(Integer id);

    void update(Permission permission);

    @Delete("delete from t_permission where id=#{id}")
    void delete(Integer id);

    @Select("select permissionid from t_role_permission where roleid=#{roleid}")
    List<Integer> findPermissionsByRoleId(Integer roleid);

    List<Permission> findPermissionsByUser(User dbUser);
}
